<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018-07-19
 * Time: 下午 3:13
 */
namespace app\admin\model;
use think\Model;
class IllegalModel extends Model
{
    // 确定链接表名
    protected $name = 'illegal';
    //查询违章订单列表
    public function getIllegalByWhere($where, $offset, $limit,$join,$condition)
    {
        return $this->where($where)
            ->join($join,$condition)
            ->limit($offset, $limit)
            ->order('snake_illegal.illegal_id desc')
            ->select();
    }
    //导出查询
    public function getIllegalOutByWhere($where,$join,$condition)
    {
        return $this->where($where)
            ->join($join,$condition)
            ->select();
    }
    //查违章订单总量
    public function getIllegalCount($where,$join,$condition)
    {
        return $this->where($where)
        ->join($join,$condition)->count();
    }
    //违章状态
    public function getIllegalStatus($status){
        if($status == '0'){//订单状态 0:新订单 5:已收款 6:办理中 7:已下网(对用户来说就是处理成功了) 8:已退款 12:订单取消 13:未完善证件信息
            $msg = '新订单';
        }elseif($status == 5){
            $msg = '已收款';
        }elseif($status == 6){
            $msg = '办理中';
        }elseif($status == 7){
            $msg = '处理成功';
        }elseif($status == 8){
            $msg = '已退款';
        }elseif($status == 12){
            $msg = '订单取消';
        }else{
            $msg = '未完善证件信息';
        }
        return $msg;
    }
    //删除
    public function getIllegalDel($id){
        return $this->where($id)->delete();
    }
}